/**
 *
 *
 */
package com.javaframe.role.tools;

/**
 * 查询条件类, 传递查询条件使用该类
 *
 * @version 
 * @author mengfang  2011-7-17 下午04:00:11
 * 
 */
public class ConditionInfo {
   private String conditionName;//查询条件
   private Object conditionValue;//查询条件的值
   private String algorithm;//查询条件的等式
   private String alias;//查询对象的假名
   ConditionInfo(String cName, Object cValue, String algorithm, String alias) {
      this.conditionName = cName;
      this.conditionValue = cValue;
      this.algorithm = algorithm;
      this.alias = alias;
   }
   public static ConditionInfo newCondition(String cName, Object cValue) {
      return newCondition(cName, cValue, GenericsUtils.SQL_ALGORITHM_EQUAL);
   }
   public static ConditionInfo newCondition(String cName, Object cValue, String algorithm) {
      return newCondition(cName, cValue, algorithm, null);
   }
   public static ConditionInfo newCondition(String cName, Object cValue, String algorithm, String as) {
      return new ConditionInfo(cName, cValue, algorithm, as);
   }
   public String getAlias() {
      return GenericsUtils.isEmpty(alias) ? "" : (alias + ".");
   }
   public void setAlias(String alias) {
      this.alias = alias;
   }
   public String getConditionName() {
      return conditionName;
   }
   public void setConditionName(String conditionName) {
      this.conditionName = conditionName;
   }
   public Object getConditionValue() {
      return conditionValue;
   }
   public void setConditionValue(Object conditionValue) {
      this.conditionValue = conditionValue;
   }
   public String getAlgorithm() {
      return algorithm;
   }
   public void setAlgorithm(String algorithm) {
      this.algorithm = algorithm;
   }
}
